﻿@using FwProject.Com.Dto
@model Guid
@{
}
<style>
    .layui-table tr th, .layui-table tr td {
        text-align: center;
        padding: 9px 15px !important
    }
</style>

<div class="layui-form" style="padding:10px;">
    <div class="layui-data layui-table-container layui-table-view">
        <table class="layui-hide layui-table" id="layui-table" lay-filter="demoEvent"></table>
    </div>
    <div class="layui-layer-btn layui-layer-btn-" style="padding:8px 12px;z-index:1000;position: fixed;bottom:0;left: 1px;width: 98%;height: 50px; background:rgba(230,230,230,0.8)">
        <a id="save" class="layui-layer-btn0" type="submit" lay-submit="" lay-filter="saveprops">确认</a>
    </div>
</div>
@section scripts{
    <script src="~/js/main.js"></script>
    <script type="text/javascript">
        var form, layer, layedit, table;
        layui.use(['form', 'layedit', 'layer', 'table'], function () {
            layedit = layui.layedit;
            form = layui.form;
            layer = layui.layer;
            table = layui.table;

            table.render({
                elem: "#layui-table",
                url: '/Order/GetOrderDetalisData',
                where: { id: "@Model", status:"Receipt"},
                cellMinWidth: 26,
                cols: [[
                    { type: 'checkbox', LAY_CHECKED: true },
                    { field: 'shopName', title: '商品名称', width: 170 },
                    { field: 'productCount', title: '购买数量', width: 162 },
                    { field: 'payPrice', title: '单价', width: 161 },
                ]],
                text: {
                    none: '暂无需要收货的商品' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                },
                id: "idTest",

                height: 300,
                page: false,//是否开启分页
                //skin: 'line',

                even: false,//开启隔行背景
                //size: 'lg' //小尺寸的表格
            });

            $("#save").on('click', function () {
                var checkStatus = table.checkStatus('idTest');
                var checkData = checkStatus.data;
                if (checkData.length > 0) {
                    layer.confirm('确认顾客已收到货了吗？', {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        var ids = new Array();
                        for (var i = 0; i < checkData.length; i++) {
                            ids.push(checkData[i].id);
                        }
                        $.post("/Order/OrderReceipt", { ids: ids }, function (obj, successInfo) {
                            CommonAjaxCallback(obj, function () {
                                parent.layer.msg('收货成功！')
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭当前iframe页面
                            }, successInfo)
                        })
                    });
                }
                else {
                    layer.msg("请选择商品进行收货")
                }
            })

        })
    </script>
}

